﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Iterator
{
    class Program
    {
        static void Main(string[] args)
        {
            Container container = new AnimalContainer();
            Iterator iterator = container.GetIterator();
            print(iterator);

            container = new NameContainer();
            iterator = container.GetIterator();
            print(iterator);

            System.Console.ReadKey();//
        }
        public static void print(Iterator iterator)
        {
            System.Console.Write( iterator.ToString()+":\n");
            while(iterator.HasNext())
            {
                System.Console.Write(iterator.Next()+",");
            }
            System.Console.WriteLine("\n");
        }
    }
}
